package kr.totalcall.controls
{
	import flash.media.Sound;
	import flash.media.SoundChannel;
	import flash.net.URLRequest;

	public class SoundController
	{
		
		public static var card_sound_dingdong:Sound = new Sound(new URLRequest("./snd/card_dingdong.mp3"));
		public static var soundChannel_dingdong:SoundChannel;
		
		
		/**
		 * 카드 요청 사운드 시작
		 */
		public static function cardReqSoundStart():void{
				
			if(soundChannel_dingdong){
				//trace(soundChannel_dingdong.position);
				if(soundChannel_dingdong.position > 0){
					return;
				}
				//soundChannel_dingdong.stop();
			}
			soundChannel_dingdong = card_sound_dingdong.play(0, int.MAX_VALUE);
		}
		
		
		/**
		 * 카드 요청 사운드 멈춤
		 */
		public static function cardReqSoundStop():void{
			if(soundChannel_dingdong){
				soundChannel_dingdong.stop();
			}
			soundChannel_dingdong = null;
		}
		
		
		
		public static var recv_sound_dingdong:Sound = new Sound(new URLRequest("./snd/recv_dingdong.mp3"));
		public static var soundChannel_dingdong_recv:SoundChannel;
		
		
		/**
		 * 카드 요청 사운드 시작
		 */
		public static function internetRecvSoundStart():void{
			
			if(soundChannel_dingdong_recv){
				//trace(soundChannel_dingdong.position);
				if(soundChannel_dingdong_recv.position > 0){
					return;
				}
				//soundChannel_dingdong.stop();
			}
			soundChannel_dingdong_recv = recv_sound_dingdong.play(0, int.MAX_VALUE);
		}
		
		
		/**
		 * 카드 요청 사운드 멈춤
		 */
		public static function internetRecvSoundStop():void{
			if(soundChannel_dingdong_recv){
				soundChannel_dingdong_recv.stop();
			}
			soundChannel_dingdong_recv = null;
		}
		
		
		public function SoundController()
		{
		}
	}
}